import api from "@/utils/api"
export default {
    actions: {
    /**
     * 用户注册
     * @param {Object} content vuex content 上下文
     * @param {Object} info 用户注册信息
     */
        registered(content, info) {
            return new Promise((resolve, reject) => {
                api({
                    method: "post",
                    url: "/user/reg",
                    params: info
                }).then(res => {
                    resolve(res.data.content)
                }).catch(err => {
                    reject(err)
                })
            })
        },
        /**
     * 用户注册
     * @param {Object} content vuex content 上下文
     * @param {Object} info 用户登录信息
     */
        logined(content, info) {
            return new Promise((resolve, reject) => {
                api({
                    method: "post",
                    url: "/user/login",
                    params: info
                }).then(res => {
                    resolve(res.data)
                }).catch(err => {
                    reject(err)
                })
            })
        },
        test(content) {
            return new Promise((resolve, reject) => {
                api({
                    method: "get",
                    url: "/user/userlist"
                }).then(res => {
                    resolve(res.data)
                }).catch(err => {
                    reject(err)
                })
            })
        }
    }
}
